<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!doctype html>
<html class="no-js">
<head>
    <%@ include file="./../common/meta.jsp" %>
    <link rel="stylesheet" href="../../css/ecshop-list.css">
    <link rel="stylesheet" href="../../css/store.css">
</head>
<body>
<header data-am-sticky class="am-header am-header-default am-no-layout">
    <div class="am-header-left am-header-nav">
        <a href="./ecshop-detail.jsp" class="" id="last">
            <i class="am-header-icon am-icon-chevron-left"></i>
        </a>
    </div>
    <h1 class="am-header-title">商铺</h1>
</header>

<div class="am-content">

    <figure data-am-widget="figure" class="am am-figure am-figure-default" data-am-figure=""
            id="detail-headimage">
    </figure>


    <div class="det-title">店铺地址</div>
    <article data-am-widget="paragraph"
             class="am-paragraph am-paragraph-default shopaddress"

             data-am-paragraph="{ tableScrollable: true, pureview: true }">

    </article>


    <div class="det-title">店铺简介</div>
    <article data-am-widget="paragraph"
             class="am-paragraph am-paragraph-default shopdetail"

             data-am-paragraph="{ tableScrollable: true, pureview: true }">

    </article>


    <div class="det-title">全部产品</div>
    <div class="am-tabs-bd" style="-moz-user-select: none;">
        <div class="am-tab-panel am-fade am-in am-active">
            <div class="am-g" id="cataProductPannel">

            </div>
        </div>
    </div>


</div>


<%@ include file="./../common/footerNav.jsp" %>
<%@ include file="./../common/footer.jsp" %>


<script id="detail-headimage-template" type="text/x-handlebars-template">


    <img src="{{imageBase}}{{shopimage}}" height="200px"/>
    <figcaption class="am-figure-capition-btm">
        {{shopname}}
    </figcaption>

</script>


<script id="product-list-template" type="text/x-handlebars-template">

    {{#each productList}}
    <div class="am-u-sm-6">
        <div class="am-thumbnail">
            <a href="./ecshop-detail.jsp?pid={{id}}">
                <img src="{{../imageBase}}{{picture}}">
                <h3 class="am-thumbnail-caption">{{name}}</h3>
            </a>
            <span class="price">￥{{nowPrice}}</span>
        </div>
    </div>
    {{/each}}

</script>


<script id="shop-detail-template" type="text/x-handlebars-template">

    <article data-am-widget="paragraph"
             class="am-paragraph am-paragraph-default"
             data-am-paragraph="{tableScrollable: true}">
        <p id="detail">{{shopdetail}}</p>

    </article>

</script>


<script id="shop-address-template" type="text/x-handlebars-template">

    <article data-am-widget="paragraph"
             class="am-paragraph am-paragraph-default"
             data-am-paragraph="{tableScrollable: true}">


        <div id="province">{{province}}{{city}}{{area}}</div>
        <div id="address">{{address}}</div>
    </article>

</script>


<script>
    var pid = "<%=request.getParameter("pid")%>";
    var href = $("#last").attr("href");
    $("#last").attr("href", href + "?pid=" + pid);


    var shopId = "<%=request.getParameter("shopId")%>";


    var url = "/product/shopDetail?id=" + shopId;
    $.post(url, function (result) {

        var source = $('#detail-headimage-template').html();
        var template = Handlebars.compile(source);
        var html = template(result);
        $("#detail-headimage").append(html);

//
        var source = $('#product-list-template').html();
        var template = Handlebars.compile(source);
        var html = template(result);
        $("#cataProductPannel").append(html);
//
//
        var source = $('#shop-detail-template').html();
        var template = Handlebars.compile(source);
        var html = template(result);
        $(".shopdetail").append(html);



        var source = $('#shop-address-template').html();
        var template = Handlebars.compile(source);
        var html = template(result);
        $(".shopaddress").append(html);
//
//
//        var source = $('#haodian-consumer-detail-template').html();
//        var template = Handlebars.compile(source);
//        var html = template(result);
//        $("#consumerDetail").append(html);
//
//
//        var source = $('#service-template').html();
//        var template = Handlebars.compile(source);
//        var html = template(result);
//        $("#service-list").append(html);
//
//
//        var source = $('#designer-template').html();
//        var template = Handlebars.compile(source);
//        var html = template(result);
//        $("#shopDesigner").append(html);


    });


</script>

</body>


</html>